home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / initrd.lz / initrd / scripts / casper-bottom / 24preseed < prev    next >
Encoding:
Text File  |  2009-10-28  |  1.6 KB  |  83 lines

  1. #! /bin/sh
  2.  
  3. PREREQ=""
  4. DESCRIPTION="Loading preseed file..."
  5.  
  6. . /scripts/casper-functions
  7.  
  8. prereqs ()
  9. {
  10.     echo "$PREREQ"
  11. }
  12.  
  13. case $1 in
  14. # get pre-requisites
  15. prereqs)
  16.     prereqs
  17.     exit 0
  18.     ;;
  19. esac
  20.  
  21. log_begin_msg "$DESCRIPTION"
  22.  
  23. if [ -e /preseed.cfg ]; then
  24.     chroot /root debconf-set-selections < /preseed.cfg
  25. fi
  26.  
  27. location=
  28. for x in $(cat /proc/cmdline); do
  29.     case $x in
  30.         preseed/file=*)
  31.             location="${x#preseed/file=}"
  32.             ;;
  33.         file=*)
  34.             location="${x#file=}"
  35.             ;;
  36.         url=*)
  37.             location="${x#url=}"
  38.             mount -n -o bind /sys /root/sys
  39.             mount -n -o bind /proc /root/proc
  40.             mount -n -o bind /dev /root/dev
  41.             mkdir -p /root/var/run/network
  42.             [ "$NETBOOT" ] || chroot /root dhclient eth0
  43.             chroot /root wget -P /tmp "$location"
  44.             [ "$NETBOOT" ] || chroot /root ifconfig eth0 down
  45.             umount /root/sys
  46.             umount /root/proc
  47.             umount /root/dev
  48.             location="/tmp/$(basename "$location")"
  49.             ;;
  50.         */*\?=*)
  51.             question="${x%%\?=*}"
  52.             value="${x#*\?=}"
  53.             casper-preseed /root "$question" "$value" false
  54.             ;;
  55.         */*=*)
  56.             question="${x%%=*}"
  57.             value="${x#*=}"
  58.             casper-preseed /root "$question" "$value"
  59.             ;;
  60.         locale=*)
  61.             value="${x#*=}"
  62.             casper-preseed /root debian-installer/locale "$value"
  63.             ;;
  64.     esac
  65. done
  66.  
  67. if [ "$location" ]; then
  68.     chroot /root debconf-set-selections < "/root$location"
  69. fi
  70.  
  71. reply="$(echo "GET preseed/early_command" | chroot /root debconf-communicate -fnoninteractive casper)"
  72. if [ "${reply#0 }" != "$reply" ]; then
  73.     reply="${reply#0 }"
  74.     sh -c "$reply"
  75. fi
  76.  
  77. # Clear out debconf database backup files to save memory.
  78. rm -f /root/var/cache/debconf/*.dat-old
  79.  
  80. log_end_msg
  81.  
  82. exit 0
  83.